package edu.cicese.alz.swing;

import edu.cicese.alz.reports.NFCProfile;

import javax.swing.JList;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import java.awt.Color;
import java.awt.Component;

/**
 * Created by: Eduardo Quintana Contreras
 * Date: 26/07/12
 * Time: 03:19 PM
 */
public class CustomComboBoxRenderer extends BasicComboBoxRenderer {

	public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
		if (value != null) {
			setText(((NFCProfile) value).getNewProfileName());
			if (isSelected) {
				setBackground(SwingUtil.cRollover);
			}
			else {
				setBackground(Color.WHITE);
			}
		}
		return this;
	}
}